package xinyu.customer.util;

import android.graphics.Color;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;

public class AppTextUtil {

    public static SpannableStringBuilder getSceneSpanText(String scene, String describe) {
        SpannableStringBuilder span = new SpannableStringBuilder("缩" + scene + describe);//隐藏标签字数+1个文字代替空格
        span.setSpan(new ForegroundColorSpan(Color.TRANSPARENT), 0, 1 + scene.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
        return span;
    }

    public static SpannableStringBuilder getBackgroundSpanText(int color, String describe) {
        SpannableStringBuilder span = new SpannableStringBuilder( describe);
        span.setSpan(new BackgroundColorSpan(color), 0, describe.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
        return span;
    }

}
